//
//  Kylin_TopicVideoView.m
//  03-BuDeJie
//
//  Created by Kylin on 16/3/3.
//  Copyright © 2016年 kylin. All rights reserved.
//

#import "Kylin_TopicVideoView.h"
#import "Kylin_TopicItem.h"
#import <UIImageView+WebCache.h>
@interface Kylin_TopicVideoView()
@property (weak, nonatomic) IBOutlet UILabel *playcountLabel;
@property (weak, nonatomic) IBOutlet UILabel *videotimeLabel;
@property (weak, nonatomic) IBOutlet UIImageView *imageView;

@end
@implementation Kylin_TopicVideoView

- (void)setTopicItem:(Kylin_TopicItem *)topicItem{
    
    _topicItem = topicItem;
    
    [self.imageView sd_setImageWithURL:[NSURL URLWithString:topicItem.image1]];
    
    if (topicItem.playcount >= 10000) {
        self.playcountLabel.text = [NSString stringWithFormat:@"%.1f万播放", topicItem.playcount / 10000.0];
    } else {
        self.playcountLabel.text = [NSString stringWithFormat:@"%zd播放", topicItem.playcount];
    }
    
    NSInteger minutes = topicItem.voicetime / 60;
    NSInteger seconds = topicItem.videotime % 60;
    
    self.videotimeLabel.text = [NSString stringWithFormat:@"%02zd:%02zd",minutes,seconds];
}

@end
